#-*- codeing = utf-8 -*-
#@Time : 2020/9/10 20:45
#@Author : 阳某
#@File : test4.py
#@Software : PyCharm

import threading
import time

class Mythread(threading.Thread):
    def __init__(self,n,sleep_time):
        # 把父类的构造函数重写了
        super(Mythread,self).__init__()
        self.n = n
        self.sleep_time = sleep_time
    def run(self) -> None:
        print("runnit task ",self.n)
        time.sleep(self.sleep_time)
        print("task done",self.n)
t1 = Mythread('t1',2)
t2 = Mythread('t2',4)
t1.start()
# t1.join()     #等2秒
t2.start()
t1.join()       #等2秒

print('main thread--------')

'''
class Mythread(threading.Thread):
    def __init__(self,n):
        # 把父类的构造函数重写了
        super(Mythread,self).__init__()
        self.n = n
    def run(self) -> None:
        print("runnit task ",self.n)
        time.sleep(2)
t1 = Mythread('t1')
t2 = Mythread('t2')
t1.start()
# t1.join()     #等2秒
t2.start()
t1.join()       #等2秒
print('main thread--------')
'''